/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**miniTiiger
 *
 * @author Sirli, Raido, Argo
 */

import javax.microedition.lcdui.*;

public class Intro extends Canvas implements CommandListener {
    Joonistus midlet;
    int koord_X = getWidth()/2;
    int koord_Y = getHeight()/2;
    int elud = 5, punktid = 0, kiiruse_lisaja = 0, kingi_lisaja = 0, kinke_lisatud = 0;
    private Command cmExit,cmStart;  // Exit midlet
    static Image taust = null;

    public Intro(Joonistus midlet){
        this.midlet = midlet;
        cmExit = new Command("Välju", Command.EXIT, 1);
        cmStart = new Command("Alusta", Command.ITEM, 1);
        addCommand(cmExit);
        addCommand(cmStart);
        setCommandListener(this);
        try{
            taust = Image.createImage("/taust.png");
        } catch (java.io.IOException e){
            System.err.println("Unable to locate or read .png file"+e);
        }
    }

    protected void paint(Graphics g){
        g.setColor(250, 0, 0);
        g.setStrokeStyle(Graphics.DOTTED);
        g.setFont(Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_SMALL));
       // g.drawImage(taust, koord_X, koord_Y, Graphics.HCENTER| Graphics.VCENTER );
        g.drawString("Jõuluvana kingimasin", 5, 5, Graphics.TOP | Graphics.LEFT);
        g.drawString("läks katki!", 5, 25, Graphics.TOP | Graphics.LEFT);
        g.drawString("Aita Tiigrit ja", 5, 45, Graphics.TOP | Graphics.LEFT);
        g.drawString("püüa kingitused kotti...", 5, 65, Graphics.TOP | Graphics.LEFT);
    }

    protected void keyPressed(int kood){
        if(getGameAction(kood)==Canvas.FIRE){
            midlet.display.setCurrent(midlet.louend);
        }
    }

    public void commandAction(Command c, Displayable d){
        if (c == cmExit){
            midlet.exitMIDlet();
        }
        if (c == cmStart){
            midlet.display.setCurrent(midlet.louend);
            Louend.elud = 5;
            Louend.punktid = 0;
        }
    }
}